package com.woniuxy.credit_loans.staff_ma.controller;

import com.woniuxy.credit_loans.entity.ChangeRole;
import com.woniuxy.credit_loans.staff_ma.service.ChangeRoleService;
import com.woniuxy.credit_loans.staff_ma.vo.ChangeRoleVo;
import com.woniuxy.credit_loans.util.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/changeRoles")
public class ChangeRoleController {
    @Autowired
    private ChangeRoleService changeRoleService;

//  产品申请表关联方法，查询公司相关信息，--刘杰 2022/12/7 17:40
    @ApiOperation(value = "查询所有公司名称")
    @GetMapping("/selectAllConpany")
    public Result selectAllConpany(){
        List<ChangeRole> changeRoles = changeRoleService.selectAllCompany();
        return Result.ok().data("changeRoles",changeRoles);
    }

    @ApiOperation(value = "根据表单公司改变事件，查询对应的银行id及银行账户")
    @PostMapping("{id}")
    public Result selectByCompanyId(@PathVariable int id){
        ChangeRoleVo changeRoleVo = changeRoleService.selectbyCompanyId(id);
        return Result.ok().data("productApp",changeRoleVo);
    }

}